useful shell aliases
最新版はここ
環境
alias
code:sh
alias -g ...='../..'
alias -g ....='../../..'
alias -g .....='../../../..'
alias -g ......='../../../../..'
# ↑このあたりはこれを設定しておくと便利
# ... で2個上に戻れたりする
setopt auto_cd
setopt auto_pushd
setopt pushd_ignore_dups
setopt pushdminus
alias -- -='cd -'
alias c='clear'
alias l='ls -lah'
alias mv='mv -i'
alias cp='cp -i'
# vim
alias v='vim'
alias vi='vim'
# git
alias ga='git add'
alias gap='git add -p'
alias gc='git commit -v -m' # $ gc 'hogehoge' でコミット
alias gst='git status'
alias gd='git diff'
alias gf='git fetch'
alias gcob='git checkout -b'
alias gpull='git pull origin git rev-parse --addrev-ref HEAD'
alias gpush='git push origin git rev-parse --addrev-ref HEAD'
alias gdmerged='git branch --merged | grep -vE "^\*|master|develop|staging$" | xargs -I % git branch -d %' # remoteで削除済みのブランチをローカルで削除
# github
alias github='gh repo view --web'
alias pr='gh pr create'
# docker,kubernetes
alias dc='docker-compose'
alias kc='kubectl'
インタラクティブ系
code:sh
# fzf, gnu-sed が必要
his() {
print -z $( ( -n "$ZSH_NAME" && fc -l 1 || history) | fzf +s --tac --reverse | gsed -r 's/ *0-9*\*? *//' | gsed -r 's/\\/\\\\/g') }
# fzf が必要
gco() {
local branches branch
branches=$(git branch --all | grep -v HEAD) &&
branch=$(echo "$branches" |
fzf-tmux -d $(( 2 + $(wc -l <<< "$branches") )) +m) &&
git checkout $(echo "$branch" | gsed "s/.* //" | gsed "s#remotes/^/*/##") }
gitのaliasは色々設定してるが、実際add,add -p, commit,status,fetch, pull, pushはtigでやってる